#-*-coding:utf-8-*-
__author__ = 'luv'

import get_conn

#biding.py 没有连接数据库表，get_conn
def find_openid(stuid):
    conn = get_conn.get_conn()  #以后每次需要数据库连接就是用connection（）函数获取连接就好了
    cur = conn.cursor()

    SQL = "SELECT * FROM biding WHERE StuID = '" + str(stuid) + "'"
    r = cur.execute(SQL)
    r = cur.fetchone()
    cur.close()
    conn.close()
    return {"openid":r[0]}

def find_stuid(openid):
    conn = get_conn.get_conn()  #以后每次需要数据库连接就是用connection（）函数获取连接就好了
    cur = conn.cursor()
    SQL = "SELECT * FROM biding WHERE OpenID = '" + openid +"'"
    r = cur.execute(SQL)
    r = cur.fetchone()
    cur.close()
    conn.close()
    return  {"stu_id":r[1]}

# print find_stuid('oukl0tyWwmQIA7NRyvnjd4jABHf0')
#
# print find_openid("131279029")